package org.luxor.commons.workflow.listener.execution;

import org.activiti.engine.delegate.DelegateExecution;
import org.activiti.engine.delegate.ExecutionListener;
import org.luxor.commons.workflow.constant.VariableConst;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * 流程异常监听器
 *
 * @author Mr.yan  @date 2021/11/10
 */
public class ThrowExecutionListener implements ExecutionListener {

    private static final Logger log = LoggerFactory.getLogger(ThrowExecutionListener.class);

    @Override
    public void notify(DelegateExecution execution) {
        String startUserId = (String) execution.getVariable(VariableConst.START_USER_ID);
        String processName = (String) execution.getVariable(VariableConst.PROCESS_NAME);
        log.info("{} 发起的{}({})流程,异常结束。", startUserId, processName, execution.getProcessInstanceId());
    }

}
